// pages/info/logs/logs.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    requestLoadingComplete: true, //“没有数据”的变量，默认false，隐藏  
  },
  onLoad: function(option) {
    let that = this;
    wx.showLoading({
      title: '加载中',
    })
    var smsInfo = wx.getStorageSync('smsInfo');
    var openId = wx.getStorageSync('openId');
    wx.request({
      url: app.globalData.smsbaoApi + "/batch/graphql?query={order(openId:\"" + openId.openId + "\",uid:" + smsInfo.userId + ",from:1){uid,total,no,created_time,updated_time,gname,status}}",
      method: 'post',
      header: {

      },
      success: function(res) {
        var order = res.data.data.order;
        if (order == '' || order == undefined) {
          setTimeout(function () {
            wx.hideLoading()
          }, 1000)
          that.setData({
            requestLoadingComplete: !that.data.requestLoadingComplete
          })
        } else {
          setTimeout(function() {
            wx.hideLoading()
          }, 1000)
          that.setData({
            order: order,
          })
        }
      },
      fail: function(err) {
        setTimeout(function() {
          wx.hideLoading()
        }, 1000)
      }
    })
  }
})